package demo03usb;

public class PC {
    public void powerOn(){
        System.out.println("powerOn");
    }
    public void powerDown(){
        System.out.println("powerDown");
    }

    public void useDevice(USB usb){
        usb.open();
        if(usb instanceof Mouse){
            Mouse m=(Mouse)usb;
            m.click();
        }
        else if(usb instanceof Keyboard){
            Keyboard k=(Keyboard)usb;
            k.click();
        }
        else if(usb instanceof Audio){
            Audio a=(Audio)usb;
            a.play();
        }
        usb.close();
    }

}
